﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Etapa1.ascx.cs" Inherits="GestorUnidesc.Cadastro.Login.Etapa1" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<div>
    <div style="width: 36%; height: 40%; float: left;">
        <asp:RequiredFieldValidator ID="rfv1" runat="server" ErrorMessage="*" ControlToValidate="txtNomeUsuario"
            ForeColor="Red"></asp:RequiredFieldValidator>
        Nome
        <asp:TextBox ID="txtNomeUsuario" runat="server" CssClass="textboxM" MaxLength="32"></asp:TextBox>
        <br />
        <asp:RequiredFieldValidator ID="rfv2" runat="server" ErrorMessage="*" ControlToValidate="txtCpfUsuario"
            ForeColor="Red"></asp:RequiredFieldValidator>
        CPF
        <asp:TextBox ID="txtCpfUsuario" runat="server" CssClass="textboxM" MaxLength="11"></asp:TextBox>
        <asp:MaskedEditExtender ID="txtCpfUsuario_MaskedEditExtender" runat="server" CultureAMPMPlaceholder=""
            CultureCurrencySymbolPlaceholder="" CultureDateFormat="" CultureDatePlaceholder=""
            CultureDecimalPlaceholder="" CultureThousandsPlaceholder="" CultureTimePlaceholder=""
            Enabled="True" Mask="999,999,999,99" MaskType="Number" TargetControlID="txtCpfUsuario">
        </asp:MaskedEditExtender>
        &nbsp;&nbsp;&nbsp;
        <br />
        <asp:RequiredFieldValidator ID="rfv3" runat="server" ErrorMessage="*" ControlToValidate="txtLoginUsuario"
            ForeColor="Red"></asp:RequiredFieldValidator>
        Login
        <asp:TextBox ID="txtLoginUsuario" runat="server" CssClass="textboxM" MaxLength="20"></asp:TextBox>
        <br />
        <asp:RequiredFieldValidator ID="rfv4" runat="server" ErrorMessage="*" ControlToValidate="txtSenhaUsuario"
            ForeColor="Red"></asp:RequiredFieldValidator>
        Senha
        <asp:TextBox ID="txtSenhaUsuario" runat="server" CssClass="textboxM" MaxLength="32"
            TextMode="Password"></asp:TextBox>
        <br />
        <asp:RequiredFieldValidator ID="rfv5" runat="server" ErrorMessage="*" ControlToValidate="txtSenhaUsuarioConfirma"
            ForeColor="Red"></asp:RequiredFieldValidator>
        Confirmar Senha<asp:TextBox ID="txtSenhaUsuarioConfirma" runat="server" CssClass="textboxM"
            MaxLength="32" TextMode="Password"></asp:TextBox>
        <br />
        <asp:CheckBox ID="ckbPrimeiroAcesso" runat="server" Checked="True" 
            Text="Alterar Senha no Primeiro Acesso" />
        <br />
        <asp:RequiredFieldValidator ID="rfv6" runat="server" ErrorMessage="*" ControlToValidate="ddlSetor"
            ForeColor="Red" InitialValue="0"></asp:RequiredFieldValidator>
        Setor
        <asp:DropDownList ID="ddlSetor" runat="server" DataSourceID="edsSetor" DataTextField="DSC_SETOR"
            DataValueField="ID_SETOR" OnDataBound="ddlSetor_DataBound" Width="190px">
        </asp:DropDownList>
        <asp:EntityDataSource ID="edsSetor" runat="server" ConnectionString="name=BDCampus2Entities"
            DefaultContainerName="BDCampus2Entities" EnableFlattening="False" EntitySetName="Lista_Setor">
        </asp:EntityDataSource>
        <br />
        <asp:RequiredFieldValidator ID="rfvTipoUsu" runat="server" ErrorMessage="*" ControlToValidate="ddlTipoUsuario"
            ForeColor="Red" InitialValue="0"></asp:RequiredFieldValidator>
        Tipo de Usuário
        <asp:DropDownList ID="ddlTipoUsuario" runat="server" Width="190px" DataSourceID="odsTipoUsu"
            DataTextField="DSC_NIVELUSUARIO" DataValueField="ID_NIVELUSUARIO">
        </asp:DropDownList>
        <asp:EntityDataSource ID="odsTipoUsu" runat="server" ConnectionString="name=BDCampus2Entities"
            DefaultContainerName="BDCampus2Entities" EnableFlattening="False" EntitySetName="Lista_NivelUsuario">
        </asp:EntityDataSource>
        <br />
        Status
        <asp:RadioButtonList ID="rblStatusUsuario" runat="server" Height="26px" RepeatDirection="Horizontal">
            <asp:ListItem Selected="True" Value="True">Ativo</asp:ListItem>
            <asp:ListItem Value="False">Desativado</asp:ListItem>
        </asp:RadioButtonList>
        <br />
        <asp:Button ID="btnInserir" runat="server" Text="Inserir" OnClick="btnInserir_Click" />
        <asp:Button ID="btnLimpar" runat="server" Text="Limpar" OnClick="btnLimpar_Click"
            CausesValidation="False" /></div>
    <div style="width: 51%; height: 300px; float: left;">
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="ID_USUARIO"
            DataSourceID="edsUsuarios" CellPadding="4" ForeColor="#333333" GridLines="None">
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
            <Columns>
                <asp:TemplateField HeaderText="ID Usuário" Visible="false">
                    <ItemTemplate>
                        <asp:Label ID="lblIdUsuario" runat="server" Text='<%# Eval("ID_USUARIO")%>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="NOME_USUARIO" HeaderText="Nome" SortExpression="NOMEU_USUARIO" />
                <asp:BoundField DataField="LOGIN_USUARIO" HeaderText="Login" SortExpression="LOGIN_USUARIO" />
                <asp:TemplateField HeaderText="ID Usuário">
                    <ItemTemplate>
                        <asp:Label ID="lblCpf" runat="server" Text='<%# this.CpfFormat(Convert.ToInt64(Eval("CPF_USUARIO")))%>' />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Setor">
                    <ItemTemplate>
                        <asp:Label ID="lblSetor" runat="server" Text='<%# Eval("Lista_Setor.DSC_SETOR") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:BoundField DataField="DAT_CADASTRO" HeaderText="Data de Cadastro" SortExpression="DAT_CADASTRO"
                    DataFormatString="{0:d}" />
                <asp:TemplateField HeaderText="Status">
                    <ItemTemplate>
                        <asp:Button ID="btnDesativar" runat="server" OnClick="btnDesativar_Click" CommandArgument='<%# Eval("ID_USUARIO") %>'
                            Text='<%#(Eval("FLG_ATIVO")).ToString() == "True" ? "Ativo" : "Desativado"%>'
                            CausesValidation="False" />
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Editar">
                    <ItemTemplate>
                        <asp:Button ID="btnEditar" runat="server" OnClick="btnEditar_Click" CommandArgument='<%# Eval("ID_USUARIO") %>'
                            Text="Editar" CausesValidation="False" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <EditRowStyle BackColor="#999999" />
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#E9E7E2" />
            <SortedAscendingHeaderStyle BackColor="#506C8C" />
            <SortedDescendingCellStyle BackColor="#FFFDF8" />
            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
        </asp:GridView>
        <asp:EntityDataSource ID="edsUsuarios" runat="server" ConnectionString="name=BDCampus2Entities"
            DefaultContainerName="BDCampus2Entities" EnableFlattening="False" EntitySetName="Usuarios"
            EntityTypeFilter="Usuario" Include="Lista_Setor">
        </asp:EntityDataSource>
        <asp:DropDownList ID="ddlSetor0" runat="server" DataSourceID="edsSetor" DataTextField="DSC_SETOR"
            DataValueField="ID_SETOR" OnDataBound="ddlSetor_DataBound" Width="190px" AutoPostBack="True">
        </asp:DropDownList>
    </div>
</div>
